<template>
	<view>
		<uni-view class="cu-list menu-avatar" v-for="(item,index) in hisList" :key="index">
		<uni-view class="cu-form-group margin-top">
		  <uni-view class="title">问诊时间：{{item.createTime}}</uni-view>
		  <uni-view class="action" style="color: #F29100;" v-if="item.consultStatus==0">待完成</uni-view>
		  <uni-view class="action" style="color: #F29100;" v-if="item.consultStatus==1">已完成</uni-view>
		 </uni-view>
		<uni-view class="cu-list menu-avatar" >
		     <uni-view class="cu-item" style="border-top: 1px solid rgba(192,192,192,0.5);height: 100px;">
		       <uni-view class="cu-avatar round lg"
		         style='background-image: url(../../static/me/head.png);'>
		       </uni-view>
		       <uni-view class="content">
		         <uni-view class="text-black">
		           <uni-text class="text-cut"><span>{{item.doctorName}}</span></uni-text>
		           <uni-view class="cu-tag round bg-orange sm">在线云诊室</uni-view>
		         </uni-view>
		         <uni-view class="text-gray text-sm flex">
		           <uni-text class="text-cut">
		             <span>就诊人：{{item.personName}}</span>
		           </uni-text>
		         </uni-view>
				 <uni-view class="text-gray text-sm flex">
				   <uni-text class="text-cut">
				     <span>病情：{{item.question}}</span>
				   </uni-text>
				 </uni-view>
		       </uni-view>
		     </uni-view>
		</uni-view>
		<uni-view class="cu-form-group">
		  <uni-view class="title">复诊配药</uni-view>
		  <uni-view class="action cu-tag line-green" v-if="item.consultStatus==1"><span @click="goRecipe(index)">查看处方</span></uni-view>
		 </uni-view>
		 </uni-view>
	</view>
</template>

<script>
	var time=require('../../common/timeChange');
	export default {
		data() {
			return {
				/*hisList:[{
					consult_id:'',//单次问诊的ID
					docotor_name:'',
					prescription_type:'',
					create_time:'',
					prescription_status:,
					user_id:,
					
				},
				]*/
				hisList:null
			}
		},
		methods: {
			goRecipe(index) {
				uni.navigateTo({
					url: '../recipe/recipe?consultId='+this.hisList[index].consultId
				})
			}
		},
		onLoad() {
			uni.request({
				url: 'http://121.43.172.59:8080/consultask/findbycreatuserid', //仅为示例，并非真实接口地址。
				data: {//参数
						create_user_id:1
					},
				header: {
						'create_user_id': '1'//自定义请求头信息
					},
                method:'POST',//请求方式  或GET，必须为大写
				success: res => {
					
						console.log('返回', res.data);
						this.hisList=res.data;
						this.hisList.map((item) => {
							item.createTime=time.timeChange(item.createTime);
						})
							}
				});
                fail:res =>{
                    console.log("请求失败");
                }
		}
	}
</script>

<style>

</style>
